package scuts.core;
import utest.Assert;


using scuts.core.PartApply;


class PartApplyTest 
{

  public function new() 
  {
    
  }
  
  public function testPartApply1 () {
    var f = function (a:Int) return 2*a;
    
    var f1 = f.partApply(5);
    
    Assert.equals(10, f1());
    
    var f2 = f.partApply(_);
    
    Assert.equals(10, f2(5));
    
    
  }
  public function testPartApply4 () {
    
    
    var f = function (a:Int, b:Int, c:Int, d:Int) return a*1+b*2+c*3+d*4;
    
    var f1 = f.partApply(_, _, _, 1);
    
    Assert.equals(4, f1(0,0,0));
    
    var f2 = f.partApply(_, _, 1);
    
    Assert.equals(3, f2(0,0,0));
    
    var f3 = f.partApply(1, _, 1);
    
    Assert.equals(4, f3(0,0));
    
    
  }
  
}